package com.partner.sys.attach.core.controller;

import com.partner.common.core.controller.AbstractController;
import com.partner.common.dto.Response;
import com.partner.sys.attach.api.SysAttachMainApi;
import com.partner.sys.attach.core.service.SysAttachMainService;
import com.partner.common.dto.partner.SysAttachMainVO;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 附件文件Controller
 *
 * @author partner
 */
@Api(tags = "附件文件接口" )
@Slf4j
@RestController
@RequestMapping("/data/attach/main" )
public class SysAttachMainController extends AbstractController<SysAttachMainApi, SysAttachMainVO> {
    @Autowired
    private SysAttachMainService sysAttachMainService;

    @PostMapping("upload" )
    public Response<SysAttachMainVO> upload(MultipartFile file) {

        // 上传并返回访问地址
        SysAttachMainVO attachMainVO = sysAttachMainService.uploadFile(file);

        return Response.ok(attachMainVO);

    }


}
